<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/ajax.js"></script>
    <style>
        table,tr,th,td{
            border: 1px solid #000;
        }
    </style>
</head>
<body>
    <button>显示数据</button>
    <table>
        <thead>
            <tr>
                <th>id</th>
                <th>name</th>
                <th>age</th>
                <th>sex</th>
                <th>phone</th>
                <th>qq</th>
                <th>address</th>
            </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
    <script>
        document.querySelector("button").onclick=function(){
            $.ajax("http://useker.cn/person",function(res){
                let arr=JSON.parse(res);
                let str=``;
                for(var i=0;i<arr.length;i++){
                    str+=`
                    <tr>
                        <td>${arr[i].id}</td>
                        <td>${arr[i].name}</td>
                        <td>${arr[i].age}</td>
                        <td>${arr[i].sex}</td>
                        <td>${arr[i].phone}</td>
                        <td>${arr[i].qq}</td>
                        <td>${arr[i].address}</td>
                    </tr>
                    `
                }
                document.querySelector("tbody").innerHTML=str;
            })
        }
    </script>
</body>
</html>